import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class DecoratedboxRoute extends StatefulWidget {
  const DecoratedboxRoute({Key? key}) : super(key: key);

  @override
  _DecoratedboxRouteState createState() => _DecoratedboxRouteState();
}

class _DecoratedboxRouteState extends State<DecoratedboxRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("decorated布局"),
        ),
        body: Column(
          children: [
            DecoratedBox(
                decoration: BoxDecoration(
                    gradient: LinearGradient(
                        colors: [Colors.red, Colors.orange.shade100]),
                    borderRadius: BorderRadius.circular(20),
                    boxShadow: const [
                      BoxShadow(
                          color: Colors.black54,
                          offset: Offset(2.0, 2.0),
                          blurRadius: 4.0)
                    ]),
                child: const Padding(
                  padding: EdgeInsets.symmetric(horizontal: 80, vertical: 20),
                  child: Text(
                    'Login',
                    style: TextStyle(color: Colors.white),
                  ),
                )),
            SizedBox(
              width: 100,
              height: 100,
              child: DecoratedBox(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(50),
                  image: const DecorationImage(
                    image: AssetImage("assets/images/avatar.png"),
                    //alignment: Alignment.topLeft
                  ),
                ),
              ),
            ),
          ],
        ));
  }
}
